Bug 508601 - Copying from GTK+ applications causes crash
authorKristian Rietveld <kris@gtk.org>
Mon, 25 Jul 2011 20:02:25 +0000 (22:02 +0200)
committerKristian Rietveld <kris@gtk.org>
Mon, 25 Jul 2011 20:05:52 +0000 (22:05 +0200)
In GtkClipboardOwner pasteboard:provideDataForType do not call
_gtk_quartz_set_selection_data_for_pasteboard() is selection_data.length
is smaller than 0.  The function relies on having a positive length,
since it stores the length in a uint ...

gtk/gtkclipboard-quartz.c

index a77d44379f316d3216b83c9cdb826f988c856adf..ee7766e799b789ea268f07384c8df67a2fcc09de 100644 (file)
@@ -110,9 +110,10 @@ struct _GtkClipboardClass
       clipboard->get_func (clipboard, &selection_data,
                            info,
                            clipboard->user_data);
-      _gtk_quartz_set_selection_data_for_pasteboard (clipboard->pasteboard,
-                                                     &selection_data);
+
+      if (selection_data.length >= 0)
+        _gtk_quartz_set_selection_data_for_pasteboard (clipboard->pasteboard,
+                                                       &selection_data);
 
       g_free (selection_data.data);
     }